package com.wizo.csb.generator;

/**
 * A generator that is capable of generating Integer as well as String. 
 * @author ywu70
 *
 */
public abstract class IntegerGenerator extends Generator{
	
	int _lastInt;
	
	/**
	 * Set the last value generated.
	 */
	public void setLastInt(int last){
		_lastInt = last;
	}
	
	/**
	 * Return the next value as an int.
	 */
	public abstract int nextInteger();
	
	/**
	 * Generate the next String in the distribution.
	 */
	public String nextString(){
		return nextInteger()+"";
	}
	
	/**
	 * Return the previous String generated by the distribution.
	 * Calling lastString() should not advance the distribution or have any side effects.
	 * If nextString() has not yet been called, lastString() should return something reasonable.
	 */
	public String lastString(){
		return _lastInt+"";
	}
	
	/**
	 * Return the previous integer generated by the distribution.
	 * Calling lastInteger() should not advance the distribution or have any side effects.
	 * If nextInteger() has not yet been called, lastInteger() should return something reasonable.
	 */
	public int lastInteger(){
		return _lastInt;
	}
}
